var mimeTeXInputMethod = IBImgInputMethod.extend({
	constructor: function()
	{
	},
	IMName: function()
	{
		return 'mimeTeX';
	},
	module_name: function()
	{
		return 'mimeTeXInputMethod';
	},
	GetLanguage: function()
	{
		return 'math';
	},
	SuggestionType: function()
	{
		return 'TeX';
	},
	isKeyValid: function(key,m)
	{
		if(m != 0 && m != Const.KEY_SHIFT) return false;

		if(32 <= key && key <= 125) return true;
		else return false;
	},
	GetImageUrl: function(buf)
	{
		return 'http://ajaxime.com/cgi-bin/mimetex.cgi?' + encodeURI(buf);
	},
	onPostStart: function(pmb)
	{
		this.base(pmb);
		// check if TexHelperInputMethod available...
		var index = this.ime.LookupInputMethodByName('TeXHelper');

		Debug.present && (index < 0) && Debug.trace(2,'mimeTeXInputMethod: TexHelperInputMethod is not available.');
		Debug.present && (index >= 0) && Debug.trace(2,'mimeTeXInputMethod: TexHelperInputMethod is available, automatically switch to TeXHelperInputMethod.');
		this.ime.SelectInputMethod(index);
	},
	GetTitle: function() { return 'mimeTeX'; },
	GetInstruction: function()
	{
		return $GFS('Press Enter to complete');
	}
});


